/*
 * @Author: boyyang
 * @Date: 2022-01-04 11:03:52
 * @LastEditTime: 2022-01-04 11:15:49
 * @LastEditors: boyyang
 * @Description: 用户信息
 * @FilePath: \boyyang\src\store\modules\user.ts
 */

import { defineStore } from 'pinia'
import { store } from '@/store'

export interface IUserState {
    token: string
}

const useUserStore = defineStore({
    id: 'app-user',
    state: (): IUserState => ({
        token: 'user-token'
    }),

    getters: {
        getToken(): string {
            return this.token
        }
    },

    actions: {
        setToken(token: string) {
            this.token = token
        }
    }
})

const useUserStoreWithOut = () => {
    return useUserStore(store)
}

export {
    useUserStore,
    useUserStoreWithOut
}

